/**
 * 
 */
package com.dalonedrow.engine.sprite.base;

/**
 * @author Donald
 */
public final class SimplePoint {
	/**
	 * The X coordinate of this <code>SimplePoint</code>. If no X coordinate is
	 * set it will default to 0.
	 */
	private int	x;
	/**
	 * The Y coordinate of this <code>SimplePoint</code>. If no Y coordinate is
	 * set it will default to 0.
	 */
	private int	y;
	/**
	 * Constructs and initializes a SimplePoint at the origin (0,&nbsp;0) of the
	 * coordinate space.
	 */
	public SimplePoint() {
		this(0, 0);
	}
	/**
	 * Constructs and initializes a SimplePoint at the specified {@code (x,y)}
	 * location in the coordinate space.
	 * @param x0 the X coordinate of the newly constructed
	 *        <code>SimplePoint</code>
	 * @param y0 the Y coordinate of the newly constructed
	 *        <code>SimplePoint</code>
	 */
	public SimplePoint(final int x0, final int y0) {
		x = x0;
		y = y0;
	}
	/**
	 * Constructs and initializes a SimplePoint with the same location as the
	 * specified <code>SimplePoint</code> object.
	 * @param p a SimplePoint
	 */
	public SimplePoint(final SimplePoint p) {
		this(p.x, p.y);
	}
	/**
	 * Returns the X coordinate of this <code>SimplePoint</code> in
	 * <code>double</code> precision.
	 * @return the X coordinate of this <code>SimplePoint</code>.
	 */
	public double getX() {
		return x;
	}
	/**
	 * Returns the Y coordinate of this <code>SimplePoint</code> in
	 * <code>double</code> precision.
	 * @return the Y coordinate of this <code>SimplePoint</code>.
	 */
	public double getY() {
		return y;
	}
	/**
	 * Moves this point to the specified location in the {@code (x,y)}
	 * coordinate plane. This method is identical with
	 * <code>setLocation(int,&nbsp;int)</code>.
	 * @param newX the X coordinate of the new location
	 * @param newY the Y coordinate of the new location
	 */
	public void move(int newX, int newY) {
		x = newX;
		y = newY;
	}
    /**
     * Returns a string representation of this point and its location 
     * in the {@code (x,y)} coordinate space. This method is 
     * intended to be used only for debugging purposes, and the content 
     * and format of the returned string may vary between implementations. 
     * The returned string may be empty but may not be <code>null</code>.
     * 
     * @return  a string representation of this point
     */
    public String toString() {
	return getClass().getName() + "[x=" + x + ",y=" + y + "]";
    }
}
